<template>
	<view class="sales">
		<view class="top">
			服务类型
		</view>


		<radio-group class="btns" name="status" @change="statusChange">
			<label class="btn" :class="{active:status=='1'}">
				<!-- 状态: '1' 退货 ;  '2' 仅退款 ; -->
				<radio value="1" /><text>退货</text>
			</label>
			<label class="btn" :class="{active:status=='2'}">
				<radio value="2" /><text>仅退款</text>
			</label>
		</radio-group>
		
		
		<view class="commodity">
			<view class="backgrond">
				<view class="order">
					订单编号:{{ product.orderId }}
				</view>
				
				<view class="left">
						<view class="imgs">
							<image class="img" :src="product.cover_img" mode=""></image>
						</view>
						<view class="detail">
							<view class="name">
								<view class="gname">
									{{ product.gname }}
								</view>
								
								<view class="price">
									￥{{ product.price }}
								</view>
							</view>
							<view class="serial">
								<view class="sku_code">
									编号:{{ product.sku_code }}
								</view>
								<view class="count">
									*{{ product.count }}
								</view>
							</view>
							<view class="color_text">
								规格:{{product.color_text}}
							</view>
						</view>
						
				</view>
				<view class="count-price">
					合计:￥{{ product.count*product.price }}
				</view>
			</view>
		</view>
		
		
		<view class="issue">
			问题描述
		</view>
		<view class="textareas">
			
			 <!-- 光标位置写 -->
			 <textarea class="textarea"   @blur="textareaBlur" placeholder="请输入问题描述"/>
		</view>
		 
		 
		 	 <button class="mini-btn"  @click="goAdd">按钮</button>
		 
		   
		 
	</view>
</template>

<script>
	import orderApi from "@/api/order/index.js"
	export default {
		data() {
			return {
				product: {},
				status: "1",
				reason:''
			}
		},
		onLoad() {
			this.product = this.$store.state.order.tempOrderBack
			// console.log(this.$store.state.order.tempOrderBack)
		},
		methods: {
			statusChange(e) {
				this.status = e.detail.value;
			},
			textareaBlur(e) {
				this.reason = e.detail.value
				
			},
			goAdd(){
				orderApi.backOrder({
						userId: this.$store.getters.userId,
						orderId:this.product.orderId,
						skuId:this.product.skuId,
						reason:this.reason,
						status:this.status,
						count:this.product.count
				}).then(res =>{
					if(res.code === "S"){
						
						uni.navigateTo({
						    url: '../order?type=2'
						});
					}else{
						uni.showToast({
							title: '提交失败!',
							duration: 800
						})
					}
				
				})
			}
		},
	
	}
</script>

<style lang="scss" scoped>
	.sales {
		.top {
			padding: 21rpx 0 19rpx 42rpx;
			font-family: PingFangSC-Regular;
			font-size: 32rpx;
			color: #3E3E3E;
			letter-spacing: 2.29rpx;
		}

		.btns {
			display: flex;
			justify-content: flex-start;
			margin-left: 42rpx;

			.btn {
				width: 124rpx;
				height: 50rpx;
				border: 2rpx solid #2D4F43;
				border-radius: 10rpx;
				border-radius: 10rpx;
				text-align: center;
				font-family: PingFangSC-Regular;
				margin: 0 32rpx 32rpx 0;
				line-height: 50rpx;
				font-size: 22rpx;
				color: #354E44;
				letter-spacing: 1.57rpx;

				&.active {
					font-family: PingFangSC-Regular;
					font-size: 22rpx;
					color: #FFFFFF;
					background-color: #354E44;
					letter-spacing: 1.57rpx;
				}

				radio {
					display: none;
				}
			}


		}
		.commodity{
			display: flex;
			justify-content: center;
			.backgrond{
				width: 672rpx;
				height: 334rpx;
				background: #FFFFFF;
				box-shadow: 0 8rpx 16rpx 0 rgba(83,66,49,0.08);
				border-radius: 24rpx;
				border-radius: 24rpx;
				.order{
					padding: 22rpx 0 29rpx 36rpx;
					font-family: PingFangSC-Regular;
					font-size: 24rpx;
					color: #3E3E3E;
					letter-spacing: 1.71rpx;
				}
			.left{
				display: flex;
				.imgs{
					padding: 0 28rpx 0 36rpx;
						.img{
							width: 162rpx;
							height: 162rpx;
						}
				}
				.detail{
					.name{
						display: flex;
						ont-family: PingFangSC-Semibold;
						font-size: 26rpx;
						color: #3E3E3E;
						letter-spacing: 1.86rpx;
					.gname{
						
					}
					.price{
						position: absolute;
						right: 73rpx;
						
					}
					}
					.serial{
						padding-top: 5rpx;
						font-family: PingFangSC-Regular;
						font-size: 22rpx;
						color: #8D8D8D;
						letter-spacing: 1.57rpx;
						display: flex;
						.sku_code{
							
						}
						.count{
							position: absolute;
							right: 73rpx;
						}
					}
					.color_text{
						font-family: PingFangSC-Regular;
						font-size: 22rpx;
						color: #8D8D8D;
						letter-spacing: 1.57rpx;
					}
				}
			}
			.count-price{
				float: right;
				padding-right: 37rpx;
				font-family: PingFangSC-Regular;
				font-size: 26rpx;
				color: #3E3E3E;
				letter-spacing: 1.86rpx;
			}
			}
		}
		.issue{
			padding: 32rpx 0 31rpx 42rpx;
			font-family: PingFangSC-Regular;
			font-size: 32rpx;
			color: #3E3E3E;
			letter-spacing: 2.29rpx;
		}
		.textareas{
			display: flex;
			justify-content: center;
			.textarea{
				
				width: 672rpx;
				height: 334rpx;
				background: #FFFFFF;
				box-shadow: 0 8rpx 16rpx 0 rgba(83,66,49,0.08);
				border-radius: 24rpx;
				border-radius: 24rpx;
				
			}
		}
	
		.mini-btn{
			width: 536rpx;
			height: 94rpx;
			margin-top: 150rpx;
		
		
		
			font-family: PingFangSC-Semibold;
			
			color: #FFFFFF;
			letter-spacing: 2.14rpx;
			background: #354E44;
			border-radius: 14rpx;
			border-radius: 14rpx;
		// }	
		}
	
	}
</style>
